from flask import Flask, request, jsonify

app = Flask(__name__)

# 用于存储历史消息的列表000000000000000
message_history = []

# @app.route('/messages', methods=['POST'])
@app.route('/messages')
def post_message():
    """
    接收一个消息，将其添加到历史记录中，并返回所有历史消息。
    """
    data = request.get_json()
    if 'message' in data:
        message = data['message']
        message_history.append(message)
        return jsonify(message_history), 200
    else:
        return jsonify({'error': 'No message provided in the request body.'}), 400

if __name__ == '__main__':
    app.run(debug=True)